package com.hpeu_01.day0122.homework.test01;

import java.io.*;

/**
 * 第一题：在D盘下创建一个文件English.txt并写入26个英文字母，
 * 在D盘下再创建一个文件CopyEnglish.txt，将English.txt文件的内容复制到CopyEnglish.txt中。
 * D:\project\JAVA\java\JavaSE\src\com\hpeu_01\day0122\homework\English.txt
 */
public class Test01 {
    public static void main(String[] args) throws Exception {
        //创建一个文件English.txt并写入26个英文字母
        try (
                OutputStream os = new FileOutputStream("D:\\project\\JAVA\\java\\JavaSE\\src\\com\\hpeu_01\\day0122\\homework\\English.txt");
                InputStream is = new FileInputStream("D:\\project\\JAVA\\java\\JavaSE\\src\\com\\hpeu_01\\day0122\\homework\\English.txt");
                OutputStream osm = new FileOutputStream("D:\\project\\JAVA\\java\\JavaSE\\src\\com\\hpeu_01\\day0122\\homework\\CopyEnglish.txt");

        ){
            byte[] b = "abcdefghijklmnopqrstuvwxzy".getBytes();
            os.write(b);
            byte[] by = new byte[1024];
            int len = -1;
            while((len = is.read(by)) != -1){
                osm.write(by,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}